#!/usr/bin/env python
# -*- coding: utf-8 -*-

from django.forms import ModelForm
from django import forms
from django.contrib.localflavor.br.forms import *
from PIL import *

from si_4k.sistema.models import *

class AlunoForm(forms.ModelForm):
    celular = BRPhoneNumberField()
    telefone_casa = BRPhoneNumberField(label='Telefone de Casa', required=False)
    cpf_responsavel = BRCPFField(label='CPF do Responsável', required=False)
    telefone_pais = BRPhoneNumberField(label='Telefone do Responsável', required=False)
    data_nascimento = forms.DateField(widget=forms.DateInput(format = "%d/%m/%Y"), input_formats=("%d/%m/%Y",))
    
    class Meta:
        model = Aluno
        exclude = ['data_ingresso', 'preco_aula', 'ultimo_relatorio', 'unidade']
        
class DadosFinanceirosForm(forms.ModelForm):
    class Meta:
        model = DadosFinanceiros
        exclude = ['detalheusuario']
        
class ReferenciasForm(forms.ModelForm):
    class Meta:
        model = Referencias
        exclude = ['professor']

class FuncionarioForm(forms.ModelForm):
    telefone = BRPhoneNumberField()
    cpf = BRCPFField(required = False)
    data_nascimento = forms.DateField(widget=forms.DateInput(format = "%d/%m/%Y"), input_formats=("%d/%m/%Y",))
    
    class Meta:
        model = DetalheUsuario
        exclude = ['user', 'foto', 'unidade']
        
class InventarioForm(forms.ModelForm):
    class Meta:
        model = Inventario
        exclude = ['quantidade_total', 'valor_total']
        
class EstoqueForm(forms.ModelForm):
    data_compra = forms.DateField(widget=forms.DateInput(format = "%d/%m/%Y"), input_formats=("%d/%m/%Y",))
    class Meta:
        model = Estoque
        exclude = ['inventario', 'unidade']
        
class RelatorioAulaForm(forms.ModelForm):
    class Meta:
        model = RelatorioAula
        exclude = ['aula', 'valido']

class VerificacaoRelatorioAulaForm(forms.ModelForm):
    class Meta:
        model = RelatorioAula
        exclude = ['aula']

class RelatorioAlunoForm(forms.ModelForm):
    class Meta:
        model = RelatorioAluno
        exclude = ['aluno']
        
class LoginForm(forms.Form):
    username = forms.CharField(max_length=128, label='Usuário')
    password = forms.CharField(max_length=128, widget=forms.PasswordInput,label= 'Senha')
    
class UsuarioForm(forms.ModelForm):
    telefone = BRPhoneNumberField()
    cpf = BRCPFField(required = False)
    
    class Meta:
        model = DetalheUsuario
        exclude = ['user', 'foto', 'cargo','unidade']

class FotoForm(forms.Form):
    foto = forms.FileField(required=False, help_text="Adicione sua Foto")
    
class GastosForm(forms.ModelForm):
    class Meta:
        model = Gastos
        
class EntradaForm(forms.ModelForm):
    class Meta:
        model = Pagamento
        
class DividaForm(forms.ModelForm):
    class Meta:
        model = Divida

class VeraulaForm(forms.ModelForm):
    class Meta:
        model = Aula

class PagamentoForm(forms.ModelForm):
    class Meta:
        model = Pagamento
        
class PrecoAulaForm(forms.ModelForm):
    data_limite = forms.DateField(widget=forms.DateInput(format = "%d/%m/%Y"), input_formats=("%d/%m/%Y",))
    data_vigencia = forms.DateField(widget=forms.DateInput(format = "%d/%m/%Y"), input_formats=("%d/%m/%Y",))
    class Meta:
        model = PrecoAula
        exclude = ['unidade']
       
class DetalheUsuarioForm(forms.ModelForm):
    data_nascimento = forms.DateField(widget=forms.DateInput(format = "%d/%m/%Y"), input_formats=("%d/%m/%Y",))
    class Meta:
        model = DetalheUsuario
        fields = ['bloconotas']

class DescontodadoForm(forms.ModelForm):
    class Meta:
        model = Pagamento
        exclude = ['aluno', 'valor', 'data']
        
class LocalForm(forms.ModelForm):
    class Meta:
        model = Local

#Agenda
class AulaProfForm(forms.ModelForm):
    inicio = forms.DateTimeField(widget=forms.DateTimeInput(format = "%H:%M %d-%m-%Y"), input_formats=("%H:%M %d-%m-%Y",))
    fim = forms.DateTimeField(widget=forms.DateTimeInput(format = "%H:%M %d-%m-%Y"), input_formats=("%H:%M %d-%m-%Y",))
    class Meta:
        model = Aula
        fields = ['inicio', 'fim', 'tipo']

class AulaLocalForm(forms.ModelForm):
    inicio = forms.DateTimeField(widget=forms.DateTimeInput(format = "%H:%M %d-%m-%Y"), input_formats=("%H:%M %d-%m-%Y",))
    fim = forms.DateTimeField(widget=forms.DateTimeInput(format = "%H:%M %d-%m-%Y"), input_formats=("%H:%M %d-%m-%Y",))
    class Meta:
        model = Aula
        fields = ['inicio', 'fim', 'tipo']
        
#Boleto
class DadosBoletoForm(forms.Form):
    nome = forms.CharField(max_length=128, label = "Nome")
    rg = forms.CharField(max_length=128, label = "R.G.")
    endereco = forms.CharField(max_length=128, label = "Endereço")
    cidade = forms.CharField(max_length=128, label="Cidade")
    estado = forms.CharField(max_length=128, label="Estado")
    cep = forms.CharField(max_length=128, label="CEP")
    pagamento = forms.CharField(max_length=128, label="Valor Cobrado")
    
#
class BuscaAulaForm(forms.Form):
    aluno = forms.CharField(max_length=128, label = "Aluno", required=False)
    professor = forms.CharField(max_length=128, label = "Professor", required=False)
    local = forms.CharField(max_length=128, label = "Local da Aula", required=False)
    data = forms.DateField(widget=forms.DateInput(format = "%d/%m/%Y"), input_formats=("%d/%m/%Y",), required=False)
    unidade = forms.CharField(max_length=128, label = "Unidade", required=False)